package com.seelyn.rhea.integrate.spring;

import com.seelyn.rhea.mvc.context.Request;
import com.seelyn.rhea.mvc.context.Response;
import com.seelyn.rhea.mvc.internal.InternalRoute;
import com.seelyn.rhea.mvc.render.View;
import com.seelyn.rhea.mvc.route.Route;

/**
 * @author linfeng
 * @since 2016/1/28
 */
public class InternalRouteImpl extends InternalRoute {

    private final String method;
    private final Route route;
    private final String path;

    public InternalRouteImpl(String path, String method, Route route) {
        super(path);
        this.path = path;
        this.method = method;
        this.route = route;
    }

    @Override
    public String getPath() {
        return path;
    }

    @Override
    public View handle(Request request, Response response) {

        return route.handle(request, response);
    }

    public String getMethod() {
        return method;
    }

    public Route getRoute() {
        return route;
    }
}
